home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
PASCAL
/
0826.ZIP
/
TREF2D.ARC
/
T-REFAPX.DOC
next >
Wrap
Text File
|
1987-09-20
|
15KB
|
661 lines
Appendix A - Turbo Pascal's System Defined Identifiers
Constants:
Graphics Constants:
Black Blink Blue Brown
Cyan Darkgray Green Lightblue
Lightcyan Lightgray Lightgreen Lightmagenta
Lightred Magenta Red White
Yellow
Scalar Values:
Bw40 Bw80 C40 C80
False Maxint Nil Pi
True
Types:
Scalars:
Boolean Byte Char Integer
Real
Structured Types:
Text
Variables:
Structured Variables:
Aux Con Err Inp
Input Heapptr Kbd Lst
Out Output Trm Usr
DOS Control Variables:
Auxinptr Auxoutptr Coninptr Conoutptr
Constptr Lstoutptr Usrinptr Usroutptr
Memory Variables:
Mem MemW Port Portw
Procedures:
String Procedures:
Delete Insert Str Val
25
I/O Procedures:
Blockread Blockwrite Read Readln
Write Writeln
File Handling Procedures:
Append Assign Chain Close
Erase Execute Flush Longseek
Rename Reset Rewrite Seek
Truncate
Graphics Procedures
Draw Graphbackground Graphcolormode
Graphmode Graphwindow Hires Hirescolor
Palette Plot Textbackground Textcolor
Textmode
Text Procedures
Window
I/O Device Procedures
Auxout Conout Lstout Usrout
Heap Control Procedures
Dispose Freemem Getmem Mark
New Release
Other Procedures:
Chdir Clreol Clrscr Crtexit
Crtinit Delay Delline Exit
Fillchar Getdir Gotoxy Halt
Insline Intr Lowvideo Mkdir
Msdos Move Normvideo Nosound
Ovrpath Randomize Rmdir Sound
Functions:
String Functions:
Concat Copy Length Pos
File Handling Functions:
Eof Eoln Filepos Filesize
Longfilepos Longfilesize Ioresult Seekeof
Seekeoln
26
Heap Control Functions:
Maxavail Memavail Ord Ptr
Conversion Functions:
Chr Hi Lo Round
Swap Trunc UpCase
Arithmetic Functions:
Abs Arctan Cos Exp
Frac Int Ln Sin
Sqr Sqrt
I/O Driver Functions:
Auxin Const Conln Usrin
Scalar Functions:
Odd Pred Succ
Other Functions:
Addr Bdos Bdoshl Bios
Bioshl Cseg Dseg Keypressed
Ofs Paramcount Paramstr Random
Seg Sizeof Wherex Wherey
27
Appendix B - T-Ref Parser Error Messages
Parsing Errors:
The following is a list of the possible fatal parser error messages that
will appear if a syntactic or semantic error is detected during the parsing
process:
Error Number Description
2 Number length > 20
3 Lexical level > 20
4 String length > 132
5 "<symbol>" is unknown symbol
10 Real value expected
11 Unmatched lexical levels
12 Identifier expected
13 "<symbol>" expected
14 "<reserved word>" expected
15 Constant expected
16 Type identifier expected
18 Label expected
20 Identifier not declared
21 Identifier already declared
22 Data Element expected
23 Error in opening include file.
<symbol> in error 5 is an ASCII symbol not recognized by Turbo Pascal.
<symbol> in error 13 is the symbol expected, but was not found as the
next input token.
<reserved word> in error 14 is one of the reserved words expected as the
next token.
See page ii for system limitations for errors 1, 2, 3, and 4.
Error 11 is called if, at the end of the parse, the lexical level is not
the same as when it started.
A data element, as generated in error 22, is an individual piece of data
within the INLINE statement. See your Turbo Pascal manual for more details.
If one of these errors is detected during the parsing process, the error
will be printed on the screen in the message area (see figure 2) as well as on
the source listing (if activated). Hit any key to begin printing the ident-
ifier cross reference listing to the point the error was detected.
It must be repeated here that T-Ref was NOT designed to be a syntactic
analyzer. The error messages are simply a tool to let you know something is
wrong with the program and that T-Ref cannot successfully determine what
should be done. Therefore, if you always follow T-Ref Rule #1 (see page 1),
you should never have any problems in listing or cross referencing programs.
Memory Full error:
Although T-Ref uses every bit of available system memory (up to 640K), it
is still possible, for very large programs or for limited memory, that you
could experience the following message:
28
"Memory full error."
which means that T-Ref, in trying to save data about an identifier, ran out of
memory. If you have memory resident programs on your system while running
T-Ref (such as a Ram Disk program), reboot the system without the resident
programs and rerun T-Ref. This will make available every bit of data for
T-Ref to use. If you still experience this error, you will have to upgrade
your system with more memory, or break up your program into workable chunks
(this is usually already done through the use of include files), and run each
module through T-Ref separately.
Ready Printer:
T-Ref checks the printing device on "LPT1:" and, if it gets a "Printer
not ready" response, issues the message:
"Ready Printer or hit ESC to return:"
Check the printer to make sure it is operational, and when ready, hit any key
(except ESC, which stops the parsing process).
Opening the input file:
If T-Ref is unable to open the specified input file, it will issue the
following message:
"Unable to open the input file."
This means T-Ref could not find the file you wish to have parsed. Check the
specified directory (and subdirectory) you have set up.
Opening the output file:
If T-Ref is unable to open the output file, it issues the following
message:
"Error in creating output file."
This usually means that the number of files on the output drive and directory
is at its maximum. You will need to insert another disk or erase a file on
the output directory. Before erasing a file, make sure it is not one you need
to keep!
Error in writing to file:
If T-Ref experiences an error message when trying to write to an output
file (that is, output is not going to a printer), it issues the following
message:
"Error in writing to file."
Under normal circumstances, this implies the disk where the output is going is
probably full. You will need to insert a disk which has more available space.
29
If, for any reason, you get an error statement from T-Ref on code that
compiles properly under Turbo Pascal, please contact Synergy Software of
Nebraska. We will make every effort to correct the problem.
30
Appendix C - Backus-Naur Form of T-Ref
program ::= program_heading block "."
program_heading ::= [ PROGRAM <identifier> file_ident_list ";" ]
file_ident_list ::= [ "(" ident_list ")" ]
ident_list ::= <identifier> { "," <identifier> }
block ::= declaration_part compound_statement
declaration_part ::= { declaration_section }
declaration_section ::= label_declaration
| const_declaration
| type_declaration
| var_declaration
| proc_declaration
| func_declaration
label_declaration ::= LABEL label { "," label } ";"
label ::= <integer>
| <identifier>
const_declaration ::= CONST const_definition { ";" const_definition } ";"
const_definition ::= untyped_const_definition
| typed_const_definition
untyped_const_definition ::= <identifier> "=" constant
constant ::= <number>
| <string>
| <identifier>
typed_const_definition ::= <identifier> ":" type "=" typed_const_value
typed_const_value ::= constant { "," constant }
| "(" array_list ")"
| "[" constant { "," constant } "]"
array_list ::= constant { "," constant }
| "(" array_list ")"
{ "," "(" array_list ")" }
type_declaration ::= TYPE type_definition { ";" type_definition } ";"
type_definition ::= <identifier> "=" type
type ::= simple_type
| structured_type
| pointer_type
31
simple_type ::= scalar_type
| subrange_type
| type_identifier
scalar_type ::= "(" ident_list ")"
subrange_type ::= constant ".." constant
type_identifier ::= <identifier>
structured_type ::= [ PACKED ] unpacked_type
unpacked_type ::= string_type
| array_type
| record_type
| set_type
| file_type
string_type ::= STRING "[" constant "]"
array_type ::= ARRAY "[" simple_type { "," simple_type } "]" OF type
record_type ::= RECORD field_list END
field_list ::= [ record_section { ";" record_section } ] [ ";" variant_part ]
record_section ::= ident_list ":" type
| <null>
variant_part ::= CASE tag_field type_identifier OF variant { ";" variant }
tag_field ::= identifier ":"
| <null>
variant ::= case_label { "," case_label } ":" "(" field_list ")"
| <null>
case_label ::= constant
set_type ::= SET OF simple_type
file_type ::= FILE [ OF type ]
pointer_type ::= ^ <identifier>
var_declaration ::= VAR var_definition { ";" var_definition } ";"
var_definition ::= ident_list ":" type [ ABSOLUTE absolute_constant ]
absolute_constant ::= <integer> ":" <integer>
| <identifier> [ ":" <integer> ]
proc_declaration ::= proc_heading block ";"
| proc_heading FORWARD ";"
| proc_heading EXTERNAL extern_desc ";"
32
proc_heading ::= [ OVERLAY ] PROCEDURE <identifier>
[ "(" formal_parameter_list ")" ] ";"
formal_parameter_list ::= formal_param_section { ";" formal_param_section }
formal_param_section ::= [ VAR ] ident_list [ ":" <identifier> ]
func_declaration ::= func_heading block ";"
| func_heading FORWARD ";"
| func_heading EXTERNAL extern_desc ";"
func_heading ::= [ OVERLAY ] FUNCTION <identifier>
[ "(" formal_parameter_list ")" ] ":" <identifier> ";"
extern_desc ::= <string>
| <identifier> "[" <integer> "]"
compound_statement ::= BEGIN statement { ";" statement } END
statement ::= simple_statement
| structured_statement
simple_statement ::= variable ":=" expression
| procedure_call
variable ::= <identifier> option_list
option_list ::= <null>
| "." option_list
| "^"
| "[" expression { "," expression } "]"
expression ::= variable
{ [ "+" | "-" | "*" | "/" | DIV | MOD | SHL | SHR | OR | XOR
| AND | IN | ">" | "<" | "=" | "<>" | "<=" | ">=" ]
variable }
structured_statement ::= compound_statement
| if_statement
| case_statement
| while_statement
| repeat_statement
| for_statement
| with_statement
| inline_statement
if_statement ::= IF expression THEN statement { ELSE statement }
case_statement ::= CASE expression OF case_element { ";" case_element }
[ ELSE statement ] END
case_element ::= case_list ":" statement
case_list ::= constant { ".." constant } { "," case_list }
33
while_statement ::= WHILE expression DO statement
repeat_statement ::= REPEAT statement { ";" statement }
UNTIL expression
for_statement ::= FOR variable ":=" expression direction expression
DO statement
direction ::= TO
| DOWNTO
with_statement ::= WITH variable DO statement
inline_statement ::= INLINE "(" code_element { "/" code_element } ")"
code_element ::= [ ">" | "<" ] data_element { [ "+" | "-" ] data_element }
data_element ::= <identifier>
| "*"
| <integer>
34